package www.xpu.edu.app;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;

import java.util.List;

public class TalkAdapter extends ArrayAdapter<Talk> {
    private int resourceId;
    public TalkAdapter(Context context, int resource, List<Talk> objects) {
        super(context, resource, objects);
        resourceId=resource;

    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Talk talk=getItem(position);
        View view=LayoutInflater.from(getContext()).inflate(resourceId,parent,false);
        ImageView image=(ImageView)view.findViewById(R.id.image_id);
        TextView text1=(TextView)view.findViewById(R.id.text1);
        TextView text2=(TextView)view.findViewById(R.id.text2);
        TextView text3=(TextView)view.findViewById(R.id.text3);

        image.setImageResource(talk.getImageID());
        text1.setText(talk.getName());
        text2.setText(talk.getAdd());
        text3.setText(talk.getTime());
        //return super.getView(position, convertView, parent);
        return view;
    }
}
